<?php namespace footearth\phpstu;

use footearth\phpstu\ValueObject\Person;
use footearth\phpstu\ValueObject\Work;

class ValueObjectTest extends \PHPUnit_Framework_TestCase
{

    function testBadDollarWorking()
    {
        $job = new Work;

        $p1 = new Person;
        $p2 = new Person;

        $p1->wallet = $job->payDay();
        $this->assertEquals(200, $p1->wallet->getAmount());

        $p2->wallet = $job->payDay();
        $this->assertEquals(200, $p2->wallet->getAmount());

        $p1->wallet->add($job->payDay());
        $this->assertEquals(400, $p1->wallet->getAmount());

        //this is bad — actually 400 not 200
        $this->assertEquals(400, $p2->wallet->getAmount());

        //this is really bad — actually 400 not 200
        $this->assertEquals(400, $job->payDay()->getAmount());
    }
}


